[% setvar title shareable bytecode %]
<div id="archive-notice">
    <h3>This file is part of the Perl 6 Archive</h3>
    <p>To see what is currently happening visit <a href="http://www.perl6.org/">http://www.perl6.org/</a></p>
</div>
<div class='pod'>
<a name='TITLE'></a><h1>TITLE</h1>
<p>shareable bytecode</p>
<a name='VERSION'></a><h1>VERSION</h1>
<pre>   Maintainer: Stéphane Payrard &lt;<a href='mailto:stef@francenet.fr'>stef@francenet.fr</a>&gt;
   Date: 28 Sep 2000
   Mailing List: <a href='mailto:perl6-internals@perl.org'>perl6-internals@perl.org</a>
   Number: 338
   Version: 1
   Status: Developing</pre>
<a name='ABSTRACT'></a><h1>ABSTRACT</h1>
<p>perl6 should be designed so that different interpretor instances share
bytecode just like binary executables do with shared libraries.</p>
<a name='DESCRIPTION'></a><h1>DESCRIPTION</h1>
<p>perl6 should not behave like xemacs or java where virtual machines do
not share loaded bytecode.</p>
<p>Complex environments have multiple simultaneously active instances of
the perl &quot;virtual machine&quot;. These instances must tranparently share
loaded modules bytecode juste like executables do with shared
libraries. Counterexample: modperl needs an explicit strategy to (try
to) ensure sharing: it loads all the modules in the parent server</p>
<p>Sharing bytecoded modules is not enough.  Bytecoded modules must be
bundled. Otherwise the too low granularity will provoke a
multiplication of <code>mmap()p</code>ing which will results in lower
performances. Such a bundle can be called: shared bytecode library.</p>
<a name='A concrete example of shareable bytecode libraries in action'></a><h2>A concrete example of shareable bytecode libraries in action</h2>
<p>With shareable bytecode one can do CGI-type tasks without the modperl
intellectual overhead and less performance overhead than traditional
CGI that must reload and reinterpret all the code. A CGI execution
will still incur the overhead of fork-execing(), as well of open()ing
and map()ping bytecode files but there will be memory sharing and
no parsing, thanks to shareable bytecodes libraires.</p>
<a name='IMPLEMENTATION'></a><h1>IMPLEMENTATION</h1>
<p>With current perl implementation, bytecode would not need
data-segments because declarations of variables or complex data
structures are just the code that built them.</p>
<p>There are many of the classical shared libraries overhead but with a
twist: we are dealing with bytecode, not machine code. A typical
overhead is that addresses must be relative.  As usual, the overhead
of calculating absolute addresses from relative ones should be more or
less counterbalanced by better use of the cache.</p>
<a name='REFERENCES'></a><h1>REFERENCES</h1>
<p>The present RFC is an added requirement to byte-compiled modules as
describe by Simon Cozens in RFC 301 &quot;Cache byte-compiled programs and
modules&quot;</p>
</div>
